local yongyi = fk.CreateSkill{
    name = "wk_heg__yongyi",
    tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["wk_heg__yongyi"] = "雍仪",
  [":wk_heg__yongyi"] = "锁定技，当你横置时，取消之；当你因“合纵”摸牌时，你改为视为使用一张【联军盛宴】然后重铸所有【杀】。",

  ["#wk_heg__yongyi_viewas"] = "雍仪",

  ["$wk_heg__yongyi1"] = "君子不妄动，动必有道。",
  ["$wk_heg__yongyi2"] = "哎！将军过誉了！",
}

yongyi:addEffect(fk.BeforeDrawCard,{
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if not (player:hasSkill(yongyi.name) and target == player) then return false end
    return data.skillName == "alliance&" and not player:prohibitUse(Fk:cloneCard("alliance_feast"))
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data.num = 0
    local success, dat = player.room:askToUseActiveSkill(player, {skill_name = "#wk_heg__yongyi_viewas", prompt = "#wk_heg__liance-choose", cancelable = true})
    if success and dat then
      local card = Fk.skills["#wk_heg__yongyi_viewas"]:viewAs({"alliance_feast"})
      room:useCard{
        from = player,
        tos = dat.targets,
        card = card,
      }
    end
    local cards = table.filter(player:getCardIds(Player.Hand), function (id) return Fk:getCardById(id).trueName == "slash" end)
    if #cards > 0 then
      room:recastCard(cards, player, yongyi.name)
    end
    return true
  end,
})

yongyi:addEffect(fk.BeforeChainStateChange,{
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    if not (player:hasSkill(yongyi.name) and target == player) then return false end
    return not player.chained
  end,
  on_use = function(self, event, target, player, data)
      data.prevented = true
  end,
})

return yongyi